// 直播推流配置
export const streamingConfig = {
  // Node-Media-Server配置
  nms: {
    rtmp: {
      port: 1935,
      chunk_size: 60000,
      gop_cache: true,
      ping: 30,
      ping_timeout: 60,
    },
    http: {
      port: 8000,
      mediaroot: 'D:\\livechat\\media',
      allow_origin: '*',
      api: true,
    },
    auth: {
      api: true,
      api_user: process.env.STREAM_API_USER,
      api_pass: process.env.STREAM_API_PASS,
      play: true,
      publish: true,
      secret: process.env.STREAM_SECRET,
    },
  },

  // FFmpeg转码配置
  ffmpeg: {
    path: 'D:\\ffmpeg\\bin\\ffmpeg.exe',
    // 转码配置
    transcoding: {
      // 480P标清
      sd: {
        resolution: '854x480',
        bitrate: '800k',
        fps: 24,
      },
      // 720P高清
      hd: {
        resolution: '1280x720',
        bitrate: '1500k',
        fps: 30,
      },
    },
    // HLS切片
    hls: {
      enable: true,
      path: 'D:\\livechat\\media\\hls',
      fragment_time: 2, // 切片时长
      fragment_list_size: 3, // 列表大小
    },
  },

  // CDN配置
  cdn: {
    enable: true,
    type: 'aliyun', // 使用阿里云CDN
    domain: 'live.example.com',
    key: process.env.CDN_KEY,
  },
}
